

package com.hazelcast.spi.impl.operationservice.impl;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.internal.util.counters.Counter;

import static com.hazelcast.test.Accessors.getOperationService;

public final class OperationServiceAccessor {

    private OperationServiceAccessor() {
    }

    public static Counter getFailedBackupsCount(HazelcastInstance instance) {
        OperationServiceImpl operationService = getOperationService(instance);
        return operationService.failedBackupsCount;
    }

    public static int getAsyncOperationsCount(HazelcastInstance instance) {
        OperationServiceImpl operationService = getOperationService(instance);
        return operationService.asyncOperations.size();
    }

    // only used for testing
    public static String toStringAsyncOperations(HazelcastInstance instance) {
        OperationServiceImpl operationService = getOperationService(instance);
        return operationService.asyncOperations.toString();
    }
}
